<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>

<div class="app">
    <section class="col-lg-12 panel" style="min-height:40%;border:1px solid:gray">
        <jsp:include page="prescProjectTop.jsp"></jsp:include>
    </section>
    <section class="col-lg-12 panel" style="height: 50%;" id="prescItemDiv">
        <div id="treatProjectItem">
            <jsp:include page="prescProjectItemBottom.jsp"></jsp:include>
        </div>
        <div id="prescChineseItemDiv" style="display: none">
            <jsp:include page="prescChineseItem.jsp"></jsp:include>
        </div>
    </section>

    <%--<section class="col-lg-12 panel" style="display: none;min-height:40%;border:1px solid:gray">--%>
        <%----%>
    <%--</section>--%>

</div>
<script>
    function addSubProjectDivN(itemClass,applyId) {
        if (itemClass == 'B') {
            funItem(itemClass,applyId);
        } else {
            funItem(itemClass,applyId);
        }

    }



    //西药/草药单选按钮事件
    function funItem(obj,applyId) {
        if (obj == 'B') {
            $("#prescChineseItemDiv").show();
            $("#treatProjectItem").hide();
            loadDiv('prescChineseItemDiv', ctx + '/treatProjectItem/treatProjectItem/indexTreatChinese?id=' + applyId);
        } else {
            $("#prescChineseItemDiv").hide();
            $("#treatProjectItem").show();
            loadDiv('treatProjectItem', '${ctx}/treatProjectItem/treatProjectItem/indexTreat?type=2&id=' + applyId);
        }

//        $("#itemClass").val(itemClass);

    }

    function saveChinses(applyId){
        if ($('#prescChineseItemForm').parsley().validate()) {
            $.ajax({
                type: "POST",
                data: $("#prescChineseItemForm").serialize(),
                url: "${ctx}/treatProjectItem/treatProjectItem/saveChina?applyId="+applyId,
                dataType: "json",
                success: function (data) {
                    if (data.code == "success") {
                        toastr.success("保存成功");
                        loadDiv('prescChineseItemDiv', '${ctx}treatProjectItem/treatProjectItem/indexTreatChinese?applyId='+applyId);
//                        loadDiv('prescChineseItemDiv', ctx + '/doctor/prescriptionItem/chineseIndex?applyId=' + applyId);
                    } else {
                        toastr.error(data.data);
                    }
                },
                error: function (data) {
                    toastr.error('网络连接错误,请检查网络');
                }
            });
        }
//        loadDiv('prescChineseItemDiv', ctx + '/treatProjectItem/treatProjectItem/indexTreatChinese?id=' + applyId);
    }
</script>
<script src="${ctxStatic}/js/template/template.js"></script>